import eslintTs from './typescript.js';
import eslintVueRaw from './vue-raw.js';
import typescriptEslint from 'typescript-eslint';
import { parse as espree } from 'espree';
import vueEslintParser from 'vue-eslint-parser';
export default [
  ...eslintVueRaw,
  ...eslintTs,
  {
    files: ['*.ts', '*.cts', '*.mts', '*.tsx', '*.vue'],
    rules: {
      // The core 'no-unused-vars' rules (in the eslint:recommeded ruleset)
      // does not work with type definitions
      'no-unused-vars': 'off',
      // TS already checks for that, and Typescript-Eslint recommends to disable it
      // https://typescript-eslint.io/linting/troubleshooting#i-get-errors-from-the-no-undef-rule-about-global-variables-not-being-defined-even-though-there-are-no-typescript-errors
      'no-undef': 'off',
      '@typescript-eslint/no-unused-vars': 'warn',
    },
  },
  {
    plugins: { '@typescript-eslint': typescriptEslint.plugin },
    languageOptions: {
      parser: vueEslintParser,
      parserOptions: {
        parser: {
          js: espree,
          jsx: espree,
          cjs: espree,
          mjs: espree,

          ts: typescriptEslint.parser,
          tsx: typescriptEslint.parser,
          cts: typescriptEslint.parser,
          mts: typescriptEslint.parser,
        },
        extraFileExtensions: ['.vue'],
        ecmaFeatures: {
          jsx: true,
        },
      },
    },
  },
  {
    name: '@kuankuan/eslint-2024/vue-ts',
  },
];
